<template>
  <div>
    <!-- 顶部导航栏 -->
    <AppHeader style="z-index: 10"></AppHeader>
    <!-- 顶部图 -->
    <div class="top_tu">
      <h1 class="title">风景&山水</h1>
      <van-image
        width="100%"
        height="20rem"
        fit="cover"
        :src="require('../../../public/images/kkxl/Scenery/yhx_2.jpg')"
      />
    </div>

    <div class="column">
      <h2>热门景点</h2>
      <van-swipe>
        <van-swipe-item v-for="item in sceneryData " :key="item.id">
          <div class="column_card" id="c_card">
            <van-image
              height="100%"
              fit="cover"
              :src="dz+item.scenery_img1"
            />
            <span class="xiaobiao">{{item.scenery_name}}</span>
            <van-icon class="shoucang" name="like-o" size="18" />
            <div class="wenzi">
              <h4>{{item.scenery_name}}</h4>
              <p>
                {{item.scenery_content1}}
              </p>
            </div>
          </div>
        </van-swipe-item>
      </van-swipe>
    </div>

    <!-- 风景山水 -->
    <div class="column">
      <h2>主要景点</h2>
      <div class="scenery" v-for="item in sceneryData" @click="handle(item)">
        <van-image
          width="100%"
          height="70%"
          fit="cover"
          :src="dz+item.scenery_img1"
        />
        <div class="details">
          <h4>{{item.scenery_name}}</h4>
          <van-icon name="arrow" />
        </div>
      </div>
    </div>

    <!-- 底部栏 -->
    <AppFooter></AppFooter>
  </div>
</template>

<script>
import AppHeader from "@/components/AppHeader.vue";
import AppFooter from "@/components/AppFooter.vue";
import httpApi from "@/http";


export default {
  components: { AppHeader, AppFooter },
  data() {
    return {
      sceneryData:[],
      dz:'http://localhost:3010/images/'
    }
  },
  methods: {
    /** 发送请求 加载风景列表 */
    listScenery() {
      httpApi.SceneryApi.queryAllScenery().then((res) => {
        console.log("加载风景列表", res);
        this.sceneryData = res.data.data;
        // console.log(this.sceneryData);
      });
    },
    handle(item){
        this.$router.push(item.scenery_handle)
    }
  },
  mounted() {

    this.listScenery();
  },
};
</script>

<style lang="scss" scoped>
// ///////////////////////////////////////////////////////////

// 顶部样式

.dingbu {
  background-color: #fff;
}
.top_tu {
  position: relative;
  top: 0;
  padding-bottom: 2rem;
  .title {
    position: absolute;
    z-index: 10;
    top: 55%;
    left: 2rem;
    color: #fff;
    font-size: 3rem;
  }
}

// 内容样式

.hot {
  padding-bottom: 2rem;
}
h2 {
  padding-left: 1rem;
  font-size: 1.8rem;
}

.xiaobiao {
  position: absolute;
  top: 1.5rem;
  left: 1rem;
  text-align: center;
  font-size: small !important;
  padding: 0.5rem !important;
  color: #fff;
  border-radius: 10px;
  background-color: rgba($color: #000000, $alpha: 0.1);
}

// 收藏图标
.shoucang {
  position: absolute;
  top: 1.5rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  color: #fff;
  background-color: rgba($color: #000000, $alpha: 0.1);
  border-radius: 50%;
  line-height: 2.5rem;
  text-align: center;
  transform-origin: center center;
  font-weight: 900;
}

// 热门收藏图标

#rm_sc {
  background-color: #fff;
  top: 2rem;
  right: 1.5rem;
}

.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  text-align: center;
}

//热门样式
.column {
  padding: 1.5rem;

  .column_card {
    height: 23rem;
    box-shadow: 0 0 5px 5px #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0.5rem;
    position: relative;
    .wenzi {
      position: absolute;
      bottom: 0;
      color: #fff;

      h4 {
        padding: 1rem 0 1rem 1rem;
        font-size: 20px;
      }
      p {
        padding: 0 1rem;
        margin-bottom: 1rem;
        overflow: hidden;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
    }
  }

  // 风景样式
  .scenery {
    height: 10rem;
    box-shadow: 0 0 5px 5px #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0.5rem;

    .details {
      font-size: 18px;
      padding: 0.5rem 1rem;
      line-height: 18px;
      display: flex;
      flex-flow: row nowrap;
      justify-content: space-between;
    }
  }
}
</style>
